<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <link rel="stylesheet" href="css/base.css">
  <script src="https://s4.ssl.qhres.com/!928fb688/spritejs.min.js"></script>
  <style>
    html, body {
      width: 100%;
      height: 100%;
      padding: 0;
      margin: 0;
      overflow: hidden;
    }

    #scene-container {
      width: 100%;
      height: 100%;
    }
    #box-rect-demo {
      position: absolute;
      padding: 20px 0 0 20px;
      top: 0;
    }
  </style>
</head>
<body>
  <div id="scene-container"></div>
  <script>
  const {Scene, Path} = spritejs
  const scene = new Scene('#scene-container', {
    viewport: ['auto', 'auto'],
    resolution: [1540, 600],
    stickMode: 'width',
  })
  const layer = scene.layer('fglayer')
  const d = 'M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2 c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z'

  const heart1 = new Path()
  heart1.attr({
    anchor: [0.5, 0.5],
    path: {
      d,
      transform: {
        rotate: 45,
      },
      trim: true,
    },
    fillColor: '#f33',
    pos: [300, 300],
  })
  layer.appendChild(heart1)

  heart1.animate([
    {scale: 1},
    {scale: 10},
  ], {
    duration: 5000,
    iterations: Infinity,
    direction: 'alternate',
  })

  const heart2 = new Path()
  heart2.attr({
    anchor: [0.5, 0.5],
    path: {
      d,
      transform: {
        rotate: 45,
      },
      trim: true,
    },
    fillColor: '#f33',
    pos: [900, 300],
  })
  heart2.animate([
    {path: {d, trim: true, transform: {rotate: 45, scale: 1}}},
    {path: {d, trim: true, transform: {rotate: 45, scale: 10}}},
  ], {
    duration: 5000,
    iterations: Infinity,
    direction: 'alternate',
  })
  layer.appendChild(heart2)
  </script>
</body>
</html>
